<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta charset="utf-8" />
  <title>MiniDecaf Playground</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
  <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.1/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.1/js/bootstrap.bundle.min.js"></script>
  <link href="https://cdn.bootcdn.net/ajax/libs/codemirror/5.56.0/codemirror.min.css" rel="stylesheet">
  <script src="https://cdn.bootcdn.net/ajax/libs/codemirror/5.56.0/codemirror.min.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/codemirror/5.56.0/mode/clike/clike.min.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/codemirror/5.56.0/addon/edit/matchbrackets.min.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/codemirror/5.56.0/addon/selection/active-line.min.js"></script>
  <script src="./assets/js/highlight.js"></script>
  <script src="./dist/minidecaf.bundle.js"></script>
  <style>
    .container-fluid {
      background-color: #f8f8f8;
    }

    .btn {
      box-shadow: 0 2px 4px -2px rgba(0, 0, 0, 0.9);
    }

    .btn .icon {
      fill: currentColor;
    }

    @media (max-width: 575.98px) {

      #minidecaf-input .CodeMirror,
      #minidecaf-ir .CodeMirror,
      #minidecaf-asm .CodeMirror {
        height: 25rem;
      }
    }

    @media (min-width: 576px) {
      .codearea {
        height: calc(100vh - 4rem);
      }

      #minidecaf-input .CodeMirror {
        border-right: 1px solid #ccc;
        height: calc(100vh - 14rem);
      }

      #minidecaf-output .CodeMirror {
        border-right: 1px solid #ccc;
      }
    }

    .CodeMirror {
      height: 100%;
      font-size: large;
    }

    #minidecaf-input .CodeMirror,
    #minidecaf-ir .CodeMirror,
    #minidecaf-asm .CodeMirror {
      border-top: 1px solid #ccc;
    }

    #minidecaf-output .CodeMirror {
      border-top: 1px solid #ccc;
      padding: 10px;
      height: 10rem;
    }

    #output-label {
      font-size: larger;
      border-bottom: solid 1px #ccc;
      padding-bottom: 5px;
      margin-bottom: 5px;
    }
  </style>
</head>

<body>
  <div class="container-fluid vh-100">
    <div class="header d-flex flex-column justify-content-center align-items-start" style="height: 4rem">
      <button type="button" id="btn-run" class="btn btn-primary d-flex align-items-center">Run
        <svg class="icon ml-2" height="14" viewBox="8 4 10 16" width="12" xmlns="http://www.w3.org/2000/svg">
          <path d="M8 5v14l11-7z"></path>
        </svg>
      </button>
    </div>

    <div class="row codearea">
      <div class="col-sm-7 p-0 h-100">
        <div class="col-12 p-0" id="minidecaf-input"></div>
        <div class="col-12 p-0" id="minidecaf-output"></div>
        <div class="text-success" id="output-label" style="display: none;">Output:</div>
      </div>
      <div class="col-sm-5 p-0 h-100">
        <div class="col-12 p-0 h-50" id="minidecaf-ir"></div>
        <div class="col-12 p-0 h-50" id="minidecaf-asm"></div>
      </div>
    </div>

    <script src="./assets/js/editor.js"></script>
  </div>
</body>
